<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                >

    <f:subview id="certificacaoProfessorEmbutido" rendered="#{fluxoExibicaoAmdnistracao.exibirProfessorCertificacao}">

        <h:panelGrid columns="1" id="embCadUser" width="850" styleClass="center">
            <h:panelGroup id="formCadUser" styleClass="esquerda">
                <h:form id="cadUserForm" styleClass="formularioFundo">
                    <h:panelGrid columns="3" id="pai" styleClass="bvb-font">
                        <f:facet name="header">
                            <h:outputText value="#{msg.admProfCertTitle}" styleClass="formularioTitle"/>
                        </f:facet>
                        
                        <h:outputLabel value="#{msg.nome}:" id="labelNome" />
                        <h:outputText value="#{professorCertificacaoManager.professor.nomeSobreNome}" id="userNameCad"/>
                        <p:message for="userNameCad"/>
                        
                        <h:outputLabel value="#{msg.certificacoes}:" id="labelcertificacoes" title="#{msg.titleCertificacoesProfessor}"/>
                        <h:selectManyCheckbox value="#{professorCertificacaoManager.certificacoesProfessor}" id="certificacoesList" 
                                              required="true" label="#{msg.certificacoes}" styleClass="bvb-font"
                                              requiredMessage="#{msg.campoObrigatorio}" title="#{msg.titleCertificacoesProfessor}" layout="pageDirection">
                            <f:selectItems value="#{professorCertificacaoManager.certificacoesList}"/>
                             <f:converter converterId="certificacaoConverter"/>
                        </h:selectManyCheckbox>
                        <p:message for="certificacoesList"/>

                        <h:outputText value=""/>
                        <h:panelGroup id="buttonGroup">
                            <p:commandLink actionListener="#{professorCertificacaoManager.salvarProfessor()}" update="conteudoCentralGroup,messages"
                                           title="#{msg.titleButtonSalvarCadUser6}" id="buttonSalvar" styleClass="ui-button_link">
                                <h:graphicImage library="img" name="bt_salvar.png"/>
                            </p:commandLink>
                            <p:spacer width="2" height="2"/>
                            <h:commandButton  title="#{msg.titleButtonCleanCadUser2}" immediate="true" image="/resources/img/bt_limpar_red.png"
                                              id="buttonLimpar"  actionListener="#{professorCertificacaoManager.clean()}">
                                <f:ajax render="cadUserForm"></f:ajax>
                            </h:commandButton>
                        </h:panelGroup>
                    </h:panelGrid>
                </h:form>
            </h:panelGroup>

            <p:spacer width="100%" height="15px;"/>

            <h:panelGroup id="tableGroupUserCads">
                <h:form id="tableCadUserForm">
                    <p:dataTable value="#{professorCertificacaoManager.modelUsuarios}" var="usuario" id="tableUser" rows="5" paginator="true"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
                                 {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  styleClass="bvb-font"
                                 rowsPerPageTemplate="5,10,15" emptyMessage="#{msg.semRegistrosEcontrados}">
                        <f:facet name="header">
                            <h:outputText value="#{msg.richTableUsuarios}"/>
                        </f:facet>

                        <p:column id="col1" filterBy="#{usuario.nomeSobreNome}" headerText="Model" footerText="contains"
                                  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnNome}"/>
                            </f:facet>
                            <h:outputText value="#{usuario.nomeSobreNome}"/>
                        </p:column>

                        <p:column id="col2">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnLogin}"/>
                            </f:facet>
                            <h:outputText value="#{usuario.login}"/>
                        </p:column>

                        <p:column id="col4" sortBy="#{usuario.maxRole.papel}">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnPapel}"/>
                            </f:facet>
                            <h:outputText value="#{usuario.maxRole.papel}"/>
                        </p:column>

                        <p:column id="editarUsuario" styleClass="center">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnEditar}"/>
                            </f:facet>
                            <p:commandLink update="conteudoCentralGroup,messages"
                                           title="#{msg.titleButtonSalvarCadUser6}" id="buttonEditar" styleClass="ui-button_link">
                                <h:graphicImage library="img" name="user_edit_24.png"/>
                                <f:setPropertyActionListener value="#{usuario}" target="#{professorCertificacaoManager.professor}" />  
                            </p:commandLink>
                        </p:column>
                    </p:dataTable>
                </h:form>
            </h:panelGroup>
        </h:panelGrid>
    </f:subview>
</ui:composition>